package com.learnlogincheck.learnlogincheck.dao;



import com.learnlogincheck.learnlogincheck.entity.login;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface loginInterface {
    @Select("select * from user where account=#{account} and password=#{password}")
    login show(@Param("account") String account, @Param("password") String password);

    /**
     * 通过用户名获取密码
     * 参数：用户名(String)
     * 返回值:String
     */
    @Select("select password from user where account=#{account}")
    String getPassword(@Param("account") String account);

    /**
     * 通过用户名获取用户角色
     * 参数：用户名String
     * 返回值：角色Role
     */

    @Select("select r.role from userrolepermiss u join roles r on u.rid=r.id where account=#{account}")
    String getRole(@Param("account") String account);

    /**
     * 通过用户名获取权限
     * 参数：用户名String
     * 返回值：角色Role
     */

    @Select("select p.power from userrolepermiss u join permiss p on u.pid=p.id where u.account=#{account}")
    String getPermiss(@Param("account") String account);
}
